From 736a8ad48fc61869173ac00670620f86be0f2f06 Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 19 Apr 2006 20:26:31 +0000 Subject: [PATCH] Cleanup mem leak in geoniche. --- gpsbabel/geoniche.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/gpsbabel/geoniche.c b/gpsbabel/geoniche.c index 8e659d2e2..e5bf8e6aa 100644 --- a/gpsbabel/geoniche.c +++ b/gpsbabel/geoniche.c @@ -648,6 +648,7 @@ geoniche_writewpt(const waypoint *wpt) char *notes; int id; time_t tx; + char *gs; if (ct == 0) { @@ -684,7 +685,13 @@ geoniche_writewpt(const waypoint *wpt) else notes = enscape(wpt->notes); - notes = xstrappend(notes, geoniche_geostuff(wpt)); + gs = geoniche_geostuff(wpt); + if (gs) { + char *newnotes = xstrappend(notes, gs); + xfree (notes); + xfree (gs); + notes = newnotes; + } vdata = (ubyte *) xmalloc(vsize); if (vdata == NULL) -- 2.30.2